<template>
    <div class="msj_vipsearch">
        <div style="display:flex; width: 260px; align-items: center; margin-right: 10px;">
            <span>会员名称</span>
            <el-input v-model="input" :keyup="this.input=this.input.replace(/\s+/g,'')" type="text" style="width: 190px;" clearable size="small" placeholder="请输入用户名称/电话"></el-input>
        </div>
        <div v-show="isshow" style="margin-right: 10px;">
            <span>注册时间</span>
            <el-date-picker
      v-model="value1"
      style="width: 190px;"
      size="small"
      type="date"
      placeholder="选择日期">
    </el-date-picker>
        </div>
        <div>
            <el-button type="primary" icon="el-icon-search" size="small" @click="onsearch">查询</el-button>
        </div>
    </div>
</template>

<script>
export default {
    name: 'PhaemacyVipsearch',
    props:['list',"isshow"],
    data() {
        return {
            input: '',
            value1: ''
        };
    },

    mounted() {
        
    },

    methods: {
        // 查询 
        onsearch(){
            let arr=[]
            let show=true
             if(this.input==""&&(this.value1==""||this.value1==null)){
                arr=this.list
             }else{
                if(this.input!=""&&(this.value1!=""&&this.value1!=null)){
                    arr=this.list.filter(v=>(v.user.username.includes(this.input)||v.userId.includes(this.input))&&Number(new Date(`${v.zctime.split(" ")[0]} 00:00:00`))==Number(this.value1))
                }else if(this.input!=""||(this.value1!=""&&this.value1!=null)){
                    arr=this.list.filter(v=>this.input!=""?(v.user.username.includes(this.input)||v.userId.includes(this.input)):Number(new Date(`${v.zctime.split(" ")[0]} 00:00:00`))==Number(this.value1))
                }
                show=false
             }
            this.$emit('search',{arr,show})
        }
    },
};
</script>

<style  scoped>
    .msj_vipsearch{
        width: 100%;
        display: flex; align-items: center;
        font-size: 14px; margin: 20px 0;
    }
    .msj_vipsearch span{
        margin-right: 10px;
    }
</style>